package com.qq.BFMRSE.BF_MRSEController;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.qq.BFMRSE.Module.upLoadTool;
import com.qq.BFMRSE.model.encryptedIndex;
import com.qq.BFMRSE.util.BFConstants;
import com.qq.BFMRSE.util.paraseJsonUtil;
import com.sun.corba.se.spi.orbutil.fsm.Input;

@Controller
public class handlerNewEncryIndex {
	@RequestMapping(value= "/newEncryIndex",method=RequestMethod.POST)
	public void handler(HttpServletRequest request,HttpServletResponse response){
		 response.setContentType("text/html;charset=utf-8");
	     response.setCharacterEncoding("utf-8");
			Logger log=Logger.getLogger(handlerNewEncryIndex.class);
	     String userName=request.getParameter("userName");
	     if(userName==null)
	     {
	    	 userName=request.getHeader("userName");
	     }
	     InputStream is=null;
	     try {
			is=request.getInputStream();
			upLoadTool ut=new upLoadTool(userName, BFConstants.UPENCRYPTINDEX, null);
			ut.upLoadToHdfs(is);
			log.info("User:"+userName+" upload encrypted index.");
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	     
	
	     
	     
	}

}
